const http = require('http');

// 测试手机号
const phoneNumber = '19852725830';

// 构建请求选项 - 测试原始的/auth/sendCode接口
const options = {
  hostname: 'localhost',
  port: 8080,
  path: `/auth/sendCode/${phoneNumber}`,
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'isToken': 'false'
  }
};

console.log('开始测试原始验证码发送功能...');
console.log('测试手机号:', phoneNumber);
console.log('请求URL:', `http://${options.hostname}:${options.port}${options.path}`);
console.log('请求方法:', options.method);

const req = http.request(options, (res) => {
  console.log(`状态码: ${res.statusCode}`);
  console.log('响应头:', JSON.stringify(res.headers));
  
  res.on('data', (d) => {
    process.stdout.write('响应体: ');
    process.stdout.write(d);
    console.log('\n测试完成！');
  });
});

req.on('error', (e) => {
  console.error(`请求错误: ${e.message}`);
});

// 结束请求
req.end();